****************************************************************************
*Delivering remote learning using a low-tech solution: Evidence from an RCT during school closures, Liang Choon Wang, Michael Vlassopoulos, Asad Islam, and Hashibul Hassan, Journal of Political Economy: Micro, 2.3 (2024): 562–601.
****************************************************************************

****************************************************
*Do file for labeling and cleaning field data
****************************************************
pwd 
import excel "Rapid_Baseline_Survey.xlsx", firstrow clear

*Destring the data
local str "CHILD_ID CHILD_ID_repeat RECORD_ID VILLAGE_ID FAMILY_ID  program_consent respondent_relationship child_gen father_status bs21F3 bs21F4 bs21F4_test1 bs21F4_test2 bs21F5 bs21F6 bs21F7 mother_status bs21M3 bs21M4 bs21M4_test1 bs21M4_test2 bs21M5 bs21M6 bs21M7 other_income other_income_amount bs21_family_income hh_mem hh_children Hh_children_school hh_reli hh_asset hh_asset1 hh_asset2 hh_asset3 hh_asset4 hh_asset5 hh_asset6 child_dev child_dev_problem child_grade child_school child_pvt_tuition child_pt_no child_pt_exp child_pt_reason study_helper helper_rel no_helper"
foreach X of local str{
	destring `X', replace
	}
	
****label variable
label variable CHILD_ID "Child ID"
label variable CHILD_ID_repeat "Child ID repeat"
label variable RECORD_ID "Record_ID"
label variable VILLAGE_ID "Village ID"
label variable FAMILY_ID "House ID"
label variable program_consent "Will you participate if you are selected?"
label variable respondent_relationship "Respondent’s relationship with the child "
label variable child_gen "Gender"
label variable father_status "Father’s status of the child"
label variable bs21F3 "Father's Age"
label variable bs21F4 "Father’s Education level"
label variable bs21F4_test1 "Father’s reading ability test (Bengali)"
label variable bs21F4_test2 "Father’s reading ability test (English)"
label variable bs21F5 "Father’s Education"
label variable bs21F6 "Father’s Occupation"
label variable bs21F7 "Father’s Monthly Income"
label variable mother_status "Mother’s status of the child"
label variable bs21M3 "Mother's Age"
label variable bs21M4 "Mother's Education level"
label variable bs21M4_test1 "Mother’s reading ability test (Bengali)"
label variable bs21M4_test2 "Mother’s reading ability test (English)"
label variable bs21M5 "Mother's Education"
label variable bs21M6 "Mother's Occupation"
label variable bs21M7 "Mother's Monthly Income"
label variable other_income "Do this household has any other income regular source?"
label variable other_income_amount "How much you earn monthly from another source?"
label variable bs21_family_income "Total income of the family"
label variable hh_mem "Number of Household member"
label variable hh_children "Number of Children"
label variable Hh_children_school "Number of children studying at school"
label variable hh_reli "Household’s Religion"
label variable hh_asset "Household distant learning assets"
label variable child_dev "Level of child’s development"
label variable child_dev_problem "What is the problem of development"
label variable child_grade "In which class this child is studying in 2021"
label variable child_school "What type of school?"
label variable child_pvt_tuition "Does this child go to any private tuition?"
label variable child_pt_no "How many tuitions he/she is attending?"
label variable child_pt_exp "Private tuition related monthly expenditure"
label variable child_pt_reason "Does the child is going to tuition for Covid-19?"
label variable study_helper "Does anyone help this child in study regularly?"
label variable helper_rel "Who is the helper?"
label variable no_helper "Why no one help this child in study?"

***label define 
label define yesno 1 "Yes" 0 "No"
label define respondent_relationship 1 "Mother" 2 "Father" 3 "Siblings or cousin" 4 "Grand Parents" 5 "Uncle or Aunts"
label define child_gen 1 "Male" 0 "Female"
label define father_status 1 "Biological Father" 2 "Step Father" 3 "Separate (Single Mother)" 4 "Deceased" 
label define Education_Lavel  1 "Illiterate" 2 "Can read only" 3 "Can read and write"
label define Education 1 "No school at all" 2 "Attended primarily school but did not complete" 3 "Completed primary education level" 4 "Attended secondary school but did not complete" 5 "Completed secondary education level" 6 "Attended college education" 7 "Completed college education" 8 "At least some university education" 9 "Bachelor/Master’s" 10 "don't know"
label define Occupation 1 "day-laborer" 2 "Farmer" 3 "Businessman" 4 "Service" 5 "Self-employed" 6 "Unemployed" 7 "Sudent" 8 "Fisherman" 9 "Housewife" 10 "Tailor" 11 "Cobbler" 12 "Doctor" 13 "Traditional doctor" 14 "Barber" 15 "Others"
label define mother_status 1 "Biological Mother" 2 "Step Mother" 3 "Separated (Single Father)" 4 "Deceased"
label define hh_asset 1 "Basic Mobile Phone" 2 "Smartphone" 3 "Television" 4 "Radio" 5 "Computer" 6 "Tablet" 
label define child_dev_problem 1 "Lack of Physical Dev" 2 "Lack of Mental Dev" 3 "Lack of both Physical and Mental Dev"
label define child_grade 0 "Not admitted to school" 99 "Not applicable (left study)"
label define child_school 1 "Govt School" 2 "Non-Govt School" 3 "Aliya Madrasa" 4 "Kowmi/Hefz Madrasa" 
label define helper_rel 1 "Mother" 2 "Father" 3 "Siblings/cousins" 4 "Uncle/Aunts" 5 "Grandparents" 6 "Neighbors" 7 "Others"
label define no_helper 1 "do not understand study at all" 2 "No concentration, hyperactive" 3 "No one in hh to help" 4 "No one can read or write in the hh" 5 "Others"

***label values
label values program_consent yesno
label values respondent_relationship respondent_relationship
label values child_gen child_gen
label values father_status father_status
label values bs21F4 Education_Lavel 
label values bs21F4_test1 yesno
label values bs21F4_test2 yesno
label values bs21F5 Education
label values bs21F6 Occupation
label values mother_status mother_status
label values bs21M4 Education_Lavel
label values bs21M4_test1 yesno
label values bs21M4_test2 yesno 
label values bs21M5 Education
label values bs21M6 Occupation
label values other_income yesno
label values child_dev yesno
label values child_dev_problem child_dev_problem
label values child_grade child_grade
label values child_school child_school
label values child_pvt_tuition yesno
label values child_pt_reason yesno
label values study_helper yesno
label values helper_rel helper_rel
label values no_helper no_helper

*saving clean rapid baseline survey
save "Rapid_Baseline_Survey.dta", replace